package com.mujin.keji.collectionsystem.module.mypager.viewmodel;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;

import com.mujin.keji.collectionsystem.base.BaseDto;
import com.mujin.keji.collectionsystem.module.mypager.dto.CheckPwdDto;
import com.mujin.keji.collectionsystem.module.mypager.repository.CheckPwdRepositor;
import com.mujin.keji.collectionsystem.module.mypager.repository.ICheckPwdRepository;
import com.mujin.keji.collectionsystem.module.mypager.vo.CheckPwdVo;

/**
 * 重置APP 检查密码viewmodel
 *
 * @author weishixiong
 * @Time 2018-04-27
 */
public class ResetDataViewModel extends ViewModel {
    private LiveData<BaseDto<CheckPwdDto>> liveData;
    private ICheckPwdRepository checkPwdRepository;

    public LiveData<BaseDto<CheckPwdDto>> getLiveData(String pwd) {
        checkPwd(pwd);
        return liveData;
    }

    /**
     * 重置 检查密码
     *
     * @param pwd
     */
    private void checkPwd(String pwd) {
        checkPwdRepository = new CheckPwdRepositor();
        CheckPwdVo checkPwdVo = new CheckPwdVo(pwd);
        this.liveData = checkPwdRepository.checkPwd(checkPwdVo);
    }


}
